# Some cleanup functions after using distR (basically call mpi.close.Rslaves())

.Last <- function() {
        if (is.loaded("mpi_initialize")) {
        if (mpi.comm.size(1) > 0) {
            cat("Use mpi.close.Rslaves() to close slaves.")
            mpi.bcast.cmd(q("no"))
        }
        cat("Please use mpi.quit() to quit R")
        .Call("mpi_finalize")
    }
}
